package com.yz.vi.commons.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

/**
 * @description:
 * @author: yutingting
 * @create: 2021-01-22 10:01
 **/
@ApiModel
public class PageList <T> implements Serializable {
    private static final long serialVersionUID = -7116838588040870783L;
    @ApiModelProperty("查询到的总条数")
    private int total;
    @ApiModelProperty("总页数")
    private int pages;
    @ApiModelProperty("当前页，第1页为起始页")
    private int pageNO;
    @ApiModelProperty("每页条数")
    private int pageSize;
    @ApiModelProperty("数据")
    private List<T> list;

    public PageList() {
    }

    public int getTotal() {
        return this.total;
    }

    public int getPages() {
        return this.pages;
    }

    public int getPageNO() {
        return this.pageNO;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public List<T> getList() {
        return this.list;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

    public void setPageNO(int pageNO) {
        this.pageNO = pageNO;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PageList)) {
            return false;
        } else {
            PageList<?> other = (PageList)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.getTotal() != other.getTotal()) {
                return false;
            } else if (this.getPages() != other.getPages()) {
                return false;
            } else if (this.getPageNO() != other.getPageNO()) {
                return false;
            } else if (this.getPageSize() != other.getPageSize()) {
                return false;
            } else {
                Object this$list = this.getList();
                Object other$list = other.getList();
                if (this$list == null) {
                    if (other$list != null) {
                        return false;
                    }
                } else if (!this$list.equals(other$list)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof PageList;
    }

    public int hashCode() {
        int result = 1;
        result = result * 59 + this.getTotal();
        result = result * 59 + this.getPages();
        result = result * 59 + this.getPageNO();
        result = result * 59 + this.getPageSize();
        Object $list = this.getList();
        result = result * 59 + ($list == null ? 43 : $list.hashCode());
        return result;
    }

    public String toString() {
        return "PageList(total=" + this.getTotal() + ", pages=" + this.getPages() + ", pageNO=" + this.getPageNO() + ", pageSize=" + this.getPageSize() + ", list=" + this.getList() + ")";
    }
}
